﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using blackhouse.Data;
using System.Data;

namespace blackhouse.BlackApart.Data.Sql {
	public class CompanyDataAccess : AdoCompanyDataAccess {

		#region Fields

		private string connectionString;
		private MsSqlAdoDataHelper dataHelper;

		#endregion

		#region Constructors

		public CompanyDataAccess(string sqlConnectionString) {
			this.connectionString = sqlConnectionString;
			this.dataHelper = new MsSqlAdoDataHelper(this.connectionString);
			SqlVersioning versioning = new SqlVersioning(this.connectionString, this.GetType().Assembly);
		}

		#endregion

		#region AdoCompanyDataAccess Members

		public override IDataReader GetReaderForCompanyCounts() {
			this.dataHelper.Reset();
			this.dataHelper.ProcedureName = "bhp_CompanyCountsGet";
			return this.dataHelper.Execute();
		}

		public override IDataReader GetReaderForBaners(string language) {
			this.dataHelper.Reset();
			this.dataHelper.ProcedureName = "bhp_ApartmentBanerGetAll";
			this.dataHelper.AddParameter("Language", language, DbType.StringFixedLength, 5);
			return this.dataHelper.Execute();
		}

		public override IDataReader GetReaderForLanguages() {
			this.dataHelper.Reset();
			this.dataHelper.ProcedureName = "bhp_CompanyLanguagesGet";
			return this.dataHelper.Execute();
		}

		#endregion

	}
}
